# -*- coding: UTF-8 -*- 
from django import forms

GENDER_CHOICES = (
        ('N', u'选择性别：'),
        ('M', u'男'),
        ('F', u'女'),
    )

class RegForm(forms.Form):
    first_name = forms.CharField(label=u'名', max_length=20, min_length=1)
    last_name = forms.CharField(label=u'姓', max_length=20, min_length=1)
    email = forms.EmailField(label=u'您的电子邮件')
    password = forms.CharField(label=u'密码', widget=forms.PasswordInput)
    gender = forms.ChoiceField(label=u'性别', choices=GENDER_CHOICES)
    birthday = forms.DateField(label=u'生日')
    
    def clean_gender(self):
        gender = self.cleaned_data.get('gender')
        if gender == 'N':
            raise forms.ValidationError(u'请选择性别.')
        return gender
    
class EditPictureForm(forms.Form):
    picture = forms.ImageField()